package com.itheima.admin.controller;

import com.itheima.admin.DTO.LogDTO;
import com.itheima.admin.service.LogService;
import com.itheima.admin.vo.logVO;
import com.itheima.common.pojo.BaseResponseData;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author: lqj
 * @Date: 2022/08/23/10:33
 * @Description:
 */
@RestController
@RequestMapping("/log")
//spring 推荐注入方式
@RequiredArgsConstructor
public class LogController {
    private final LogService logService;


    @PostMapping("/land")
    public BaseResponseData log(@RequestBody logVO logvo) {
        return BaseResponseData.ofSuccess(logService.Log(logvo));
    }

    @PostMapping("/register")
    public BaseResponseData register(@RequestBody LogDTO logdto) {
        return BaseResponseData.ofSuccess(logService.register(logdto));
    }

    @GetMapping("/extends")
    public void extend(HttpServletResponse response) throws Exception{
        logService.extend(response);
    }
}
